package com.aloda.service.impl;

import com.aloda.mapper.LogMapper;
import com.aloda.pojo.dto.LogPageDTO;
import com.aloda.pojo.entity.Log;
import com.aloda.result.PageResult;
import com.aloda.service.LogService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class LogServiceImpl implements LogService {

    @Autowired
    private LogMapper logMapper;

    /**
     * 分页查询日志
     *
     * @param logPageDTO
     * @return
     */
    @Override
    public PageResult<Log> getLogPage(LogPageDTO logPageDTO) {
        PageHelper.startPage(logPageDTO.getCurrentPage(), logPageDTO.getPageSize());
        Page page = logMapper.selectPage(logPageDTO);
        return new PageResult(page.getTotal(),page.getResult());
    }
}
